import request from '/@/utils/request';
import { useUrlUtil } from '/@/utils/urlUtil';
import { BaseResponse } from '/@/interfaces/BaseModel';
import { BlacklistApi } from '/@/enums/jdfsystem-api-enum';
import { BaseRequest } from '/@/interfaces/BaseModel';
import {
    BlacklistInfoSearchParamModel,
    BlacklistInfoListModel,
    BlacklistInfoAddParamModel,
    BlacklistInfoEditParamModel,
    BlacklistInfoDetailModel,
    BlacklistInfoDeleteParamModel,
} from '/@/interfaces/JdfsystemModel';

function useBlacklistInfo() {
    return {
        list: function (payload: BaseRequest<BlacklistInfoSearchParamModel>) {
            return request.post<BaseResponse<BlacklistInfoListModel[]>>(BlacklistApi.LIST, payload);
        },
        detail: function (payload: Object) {
            const useUrl = useUrlUtil();
            return request.get<BaseResponse<BlacklistInfoDetailModel>>(useUrl.joinParam(BlacklistApi.DETAIL, payload));
        },
        add: function (payload: BaseRequest<BlacklistInfoAddParamModel>) {
            return request.post<BaseResponse<boolean>>(BlacklistApi.ADD, payload);
        },
        edit: function (payload: BaseRequest<BlacklistInfoEditParamModel>) {
            return request.post<BaseResponse<boolean>>(BlacklistApi.EDIT, payload);
        },
        del: function (payload: BaseRequest<BlacklistInfoDeleteParamModel>) {
            return request.post<BaseResponse<boolean>>(BlacklistApi.DEL, payload);
        },
    };
}

export default useBlacklistInfo;